﻿using SwenAssigment.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SwenAssigment
{
    public partial class BookingUpdate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string sss = (string)Session["bid"];
            if (Session["bid"] != null)
            {
                if (Label1.Text == "Label")
                {
                    string line = "select * from Room_Booking where Room_Booking_ID='" + sss + "'";
                    RADcon con = new RADcon();
                    string[] s = con.bretrieveone(line);
                    Label1.Text = s[0];
                    Label2.Text = s[1];
                    Label3.Text = s[4];
                    Label4.Text = s[5];
                    Label5.Text = s[6];
                    Label6.Text = s[7];
                    Label7.Text = s[8];
                    Label8.Text = s[9];
                    Label9.Text = s[10];
                    //TextBox1.Text = s[2];
                    //TextBox2.Text = s[3];
                    //Session["bid"] = null;
                    if (Page.Request.UrlReferrer.LocalPath == "/BookingDetail.aspx")
                    {

                    }
                    else
                    {
                        Response.Redirect("RoomAvalibility.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("RoomAvalibility.aspx");
            }
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            RADcon con = new RADcon();
            int id = int.Parse(Label1.Text);
            int ad = int.Parse(DropDownList1.Text);
            int ch = int.Parse(DropDownList2.Text);
            bool b = con.bupdate(id, ad, ch);
            if (b == true)
            {
                Session["mystat"] = "Booking Updated";
                Response.Redirect("BookingSearch.aspx");
            }
            else
            {
            }
        }
    }
}